﻿@model ConferenceScheduleModel
@{
	ViewBag.Title = Resources.ConferenceSchedule + ConstValues.strDash + ViewBag.ConferenceName;
}
<div id="menuBar" style="height:35px;">
	<div style="float: left; padding: 5px 5px; font-weight: bold; text-align: left;">
		@Resources.SchedulePlace：<input id="selSchedulePlace" class="easyui-textbox" style="height:27px; width:200px;" />&nbsp;&nbsp;
		<a href="javascript:void(0);" class="easyui-linkbutton" iconcls="icon-search" onclick="searchData();">@Resources.Search</a>&nbsp;&nbsp;
		@if ((User as ICISPrincipal).IsSSA || (User as ICISPrincipal).CSAList.Contains(Model.ConferenceId) || Utility.HasConferenceRole((User as ICISPrincipal), Model.ConferenceId, ConstValues.FunctionId.ConferenceSchedule, RoleType.添加))
		{
			<a href="javascript:void(0);" class="easyui-linkbutton" iconcls="icon-add" onclick="addData();" plain="true">@Resources.Create</a>
		}
		<a href="javascript:void(0);" class="easyui-linkbutton" iconcls="icon-export" onclick="exportData(1);" plain="true">@Resources.ExportSchedule</a>
		<a href="javascript:void(0);" class="easyui-linkbutton" iconcls="icon-export" onclick="exportData(2);" plain="true">@Resources.ExportPoster</a>
		<a href="javascript:void(0);" class="easyui-linkbutton" iconcls="icon-export" onclick="exportData(3);" plain="true">@Resources.ExportAbstract</a>
	</div>
	<form id="frmExport" method="post" target="iframeDownload">
		@Html.AntiForgeryToken()
		<input type="hidden" id="hdnConferenceId" name="ConferenceId" />
	</form>
	<iframe id="iframeDownload" style="width:0; height:0; visibility:hidden" tabindex="-1"></iframe>
	<div class="clear"></div>
</div>
<div id="dataGrid"></div>

@section bodyParts {
<div id="detailWindow" class="easyui-window"
	title="@Resources.ConferenceSchedule" data-options="closed:true,minimizable:false,iconCls:'icon-save'"
	style="width:1200px; display:none;">
	<div class="main">
		<div class="box clearfix">
			<h3 id="detailWindowTitle" class="tit01">@Resources.Create</h3>
			<form id="frmDetail" method="post">
				@Html.AntiForgeryToken()
				<table width="100%" height="100%" id="tblDetail" cellpadding="0" cellspacing="1" border="0" class="tastyle01">
					<tr>
						<td style="text-align: right;" class="w1 c1">@Resources.ConferenceName：</td>
						<td style="text-align: left;" class="w2 c2">
							<input type="hidden" id="hidID" name="Id" />
							<input type="hidden" id="hidConferenceId" name="ConferenceId" />
							<input id="txtConferenceName" disabled class="easyui-textbox" style="height:27px; width:300px;" value="@ViewBag.ConferenceName">
						</td>
						<td style="text-align: right;" class="w1 c1">@Resources.SchedulePlace：</td>
						<td style="text-align: left;" class="w2 c2">
							<input id="txtSchedulePlace" name="SchedulePlace" class="easyui-textbox" style="height:27px; width:300px;" data-options="required:true,validType:['length[1,100]']" />
						</td>
					</tr>
					<tr>
						<td style="text-align: right;" class="w1 c3">@Resources.Status：</td>
						<td style="text-align: left;" class="w2 c4">
							<select id="ddlStatus" name="Status" class="easyui-combobox" style="height:27px; width:300px;" data-options="editable:false,required:true,panelHeight:'auto'">
								<option value="@ConstValues.Status.正常">@Resources.Normal</option>
								<option value="@ConstValues.Status.暂停">@Resources.Pause</option>
							</select>
						</td>
						<td style="text-align: right;" class="w1 c3">@Resources.Sort：</td>
						<td style="text-align: left;" class="w2 c4">
							<input id="txtSort" name="Sort" class="easyui-numberbox" style="height:27px; width:300px;" />
						</td>
					</tr>
					<tr>
						<td style="text-align: right;" class="w1 c1">@Resources.Remark：</td>
						<td style="text-align: left;" class="w2 c2" colspan="3">
							<input id="txtRemark" name="Remark" class="easyui-textbox" style="height:50px; width:892px;" data-options="multiline:true, validType:['length[1,1000]']" />
						</td>
					</tr>
				</table>
			</form>
			<div class="btnDiv">
				<input type="hidden" id="hdnWindowType" />
				<input type="button" class="gbtn" onclick="saveData();" value="@Resources.Save" />&nbsp;&nbsp;
				<input type="button" class="rbtn" onclick="$('#detailWindow').window('close');" value="@Resources.Cancel" />
			</div>
		</div>
	</div>
</div>
<div id="dateTopicWindow" class="easyui-window"
     title="@Resources.ScheduleDateMaster" data-options="closed:true,minimizable:false,maximizable:false,iconCls:'icon-save'"
	style="width:1200px; display:none;">
	<div class="main">
		<div class="box clearfix">
			<h3 id="dateTopicWindowTitle" class="tit01" style="text-align:left;"><a href="javascript:void(0);" class="easyui-linkbutton" iconcls="icon-add" style="background:#919295;color:#000;border:none;margin-left:5px;" onclick="addDateTopic();">@Resources.Create</a></h3>
			<form id="frmDateTopic" method="post">
				@Html.AntiForgeryToken()
				<div><table id="dateTopicDG"></table></div>
				<table width="100%" height="100%" id="tblDateTopic" cellpadding="0" cellspacing="1" border="0" class="tastyle01">
					<tr>
						<td style="text-align: right;" class="w1 c1">@Resources.ScheduleDate：</td>
						<td style="text-align: left;" class="w2 c2">
							<input type="hidden" id="hidDateTopicConferenceId" name="ConferenceId" />
							<input type="hidden" id="hidScheduleId" name="ScheduleId" />
							<input type="hidden" id="hidScheduleDateId" name="Id" />
							<select id="dateScheduleDate" name="ScheduleDate" class="easyui-combobox" style="height:27px; width:300px;" data-options="editable:false"></select>
						</td>
						<td style="text-align: right;" class="w1 c1">@Resources.TopicName：</td>
						<td style="text-align: left;" class="w2 c2">
							<select id="ddlTopic" name="TopicId" class="easyui-combogrid" style="height:27px; width:300px;" data-options="editable:false"></select>
						</td>
					</tr>
					<tr>
						<td style="text-align: right; " class="w1 c3">@Resources.MorningForm：</td>
						<td style="text-align: left;" class="w2 c4" colspan="3">
							<input id="dateForenoonStartTime" name="ForenoonStartTime" class="easyui-timespinner" style="height:27px; width:300px;" />
							<span style="margin-left:40px;margin-right:40px">@Resources.To2</span>
							<input id="dateForenoonEndTime" name="ForenoonEndTime" class="easyui-timespinner" style="height:27px; width:300px;" />
						</td>
					</tr>
					<tr>
						<td style="text-align: right; " class="w1 c1">@Resources.AfternoonFrom：</td>
						<td style="text-align: left;" class="w2 c2" colspan="3">
							<input id="dateAfternoonStartTime" name="AfternoonStartTime" class="easyui-timespinner" style="height:27px; width:300px;" />
							<span style="margin-left:40px;margin-right:40px">@Resources.To2</span>
							<input id="dateAfternoonEndTime" name="AfternoonEndTime" class="easyui-timespinner" style="height:27px; width:300px;" />
						</td>
					</tr>
					<tr>
						<td style="text-align: right; " class="w1 c3">@Resources.EveningFrom：</td>
						<td style="text-align: left;" class="w2 c4" colspan="3">
							<input id="dateEveningStartTime" name="EveningStartTime" class="easyui-timespinner" style="height:27px; width:300px;" />
							<span style="margin-left:40px;margin-right:40px">@Resources.To2</span>
							<input id="dateEveningEndTime" name="EveningEndTime" class="easyui-timespinner" style="height:27px; width:300px;" />
						</td>
					</tr>
					<tr>
						<td style="text-align: right;" class="w1 c1">@Resources.Remark：</td>
						<td style="text-align: left;" class="w2 c2" colspan="3">
							<input id="txtDateTopicRemark" name="Remark" class="easyui-textbox" style="height:27px; width:88%;" data-options="validType:['length[1,1000]']" />
						</td>
					</tr>
				</table>
			</form>
			<div class="btnDiv">
				<input type="hidden" id="hdnDateTopicType" value="add" />
				<input type="button" class="gbtn" onclick="saveDateTopic();" value="@Resources.Save" />&nbsp;&nbsp;
				<input type="button" class="rbtn" onclick="$('#dateTopicWindow').window('close');" value="@Resources.Cancel" />
			</div>
		</div>
	</div>
</div>
<div id="topicChairmanWindow" class="easyui-window"
     title="@Resources.ChairmanMaster" data-options="closed:true,minimizable:false,maximizable:false,iconCls:'icon-save'"
	style="width:1200px; display:none;">
	<div class="main">
		<div class="box clearfix">
			<h3 id="topicChairmanWindowTitle" class="tit01">@Resources.Create</h3>
			<div id="topicChairmanDG"></div>
		</div>
	</div>
</div>
<div id="chairmanWindow" class="easyui-window"
	title="@Resources.ChairmanMaster" data-options="closed:true,minimizable:false,maximizable:false,iconCls:'icon-save'"
	style="width:1200px; display:none;">
	<div class="main">
		<div class="box clearfix">
			<h3 id="chairmanWindowTitle" class="tit01"></h3>
			<form id="frmChairman" method="post">
				@Html.AntiForgeryToken()
				<table width="100%" height="100%" id="tblChairman" cellpadding="0" cellspacing="1" border="0" class="tastyle01">
					<tr>
						<td style="text-align: right;" class="w1 c1">@Resources.Mail：</td>
						<td style="text-align: left;" class="w2 c2">
							<input type="hidden" id="hidChairConferenceId" name="ConferenceId" />
							<input type="hidden" id="hidTopicId" name="Topicid" />
							<input type="hidden" id="hidChairman" name="Chairman" />
							<input type="hidden" id="hidChairmanId" name="ChairmanId" />
							<input id="selMail" class="easyui-textbox" style="height:27px; width:300px;" />
						</td>
						<td style="text-align: right;" class="w1 c1">@Resources.FullName：</td>
						<td style="text-align: left;" class="w2 c2">
							<input id="selAuthorName" class="easyui-textbox" style="height:27px; width: 220px;" />&nbsp;&nbsp;
							<input type="button" class="gbtn" onclick="searchChairmanData();" value="@Resources.Search" />
						</td>
					</tr>
				</table>
				<div id="chairmanDG"></div>
				<div id="chairmanDG2"></div>
			</form>
			<div class="btnDiv">
				<input type="button" class="gbtn" onclick="saveChairmanData();" value="@Resources.Save" />&nbsp;&nbsp;
				<input type="button" class="rbtn" onclick="$('#chairmanWindow').window('close');" value="@Resources.Cancel" />
			</div>
		</div>
	</div>
</div>
<div id="planWindow" class="easyui-window"
	title="@Resources.ScheduleDateMaster" data-options="closed:true,minimizable:false,maximizable:false,iconCls:'icon-save'"
	style="width:1200px; display:none;">
	<div class="main">
		<div class="box clearfix">
			<form id="frmPlan" method="post">
				@Html.AntiForgeryToken()
				<input id="hidScheduleInfoId" name="Id" type="hidden" />
				<input id="hidPlanConferenceId" name="ConferenceId" type="hidden" />
				<input id="hidPlanDateId" name="ScheduleDateId" type="hidden" />
				<input id="hidContributeId" name="ContributeId" type="hidden" />
				<input id="hidDuration" name="Duration" type="hidden" />
				<input id="hidIsContribute" name="IsContribute" type="hidden" />
				<input id="hidIsLock" name="IsLock" type="hidden" />
				<input id="hidIsUp" name="IsUp" type="hidden" />
				<input id="hidScheduleStatus" name="ScheduleStatus" type="hidden" />
				<input id="hidTargetId" name="TargetId" type="hidden" />
				<div id="divPlanWindow">
					<h3 id="planWindowTitle" class="tit01">@Resources.AreaPlan</h3><table id="PlanDG"></table>
				</div>
				<div id="divWaitWindow" style="width:70%;float:left;">
					<h3 id="waitWindowTitle" class="tit01">@Resources.AreaWait</h3>
					<div style="float: center; padding: 5px 5px;  text-align: center; height:30px;color: #fff;background-color:#919295">
						@Resources.ReportType：<input id="selReportType" class="easyui-combobox" style="height:27px; width:200px;" /><span style="margin-right:50px" ></span>
						@Resources.TopicName：<input id="selTopicName" class="easyui-combobox" style="height:27px; width:300px;"  />
					</div>
					<div class="clear"></div>
					<table id="WaitDG"></table>
				</div>
				<div id="divEventWindow" style="width:30%;float:right;">
					<h3 id="eventWindowTitle" class="tit01" style="height:72px;line-height:72px">@Resources.AreaEvent</h3>
					<table id="EventDG"></table>
				</div>
			</form>
		</div>
	</div>
</div>
}

@section Scripts {
<script type="text/javascript" charset="utf-8" src="~/Scripts/datagrid-dnd.js"></script>
<script>
	common.setCurrentMenu("ConferenceSchedule");
	common.setCurrentParentMenu("#menu_a8");

	var windowWidth = $(window).width() - 285;
	var windowHeight = $(window).height() - 158;

	$(function () {
		$("#hidConferenceId").val("@Model.ConferenceId");

		$("#selSchedulePlace").textbox("textbox").bind("keydown", function (e) {
			if (e.keyCode == 13) {
				searchData()
			}
		});

		$("#selMail").textbox("textbox").bind("keydown", function (e) {
			if (e.keyCode == 13) {
				searchChairmanData()
			}
		});

		$("#selAuthorName").textbox("textbox").bind("keydown", function (e) {
			if (e.keyCode == 13) {
				searchChairmanData()
			}
		});

		$("#dataGrid").datagrid({
			url: "@Url.Action(nameof(ConferenceScheduleController.GetData),
					nameof(ConferenceScheduleController).GetControllerName(),
					new { ConferenceId = Model.ConferenceId })",
			method: "get",
			singleSelect: true,
			fitColumns: true,
			width: $(window).width() - 285,
			height: $(window).height() - 158,
			nowrap: false,
			pagination: true,
			remoteSort:true,
			pageSize: @ConstValues.DefaultGridRows,
			striped: true,
			toolbar: "#toolBar",
			pageSize: 100,
			pageList: [100, 200, 300, 400, 500],
			columns: [[
				{ field: "id", hidden: true },
				@if ((User as ICISPrincipal).IsSSA || (User as ICISPrincipal).CSAList.Contains(Model.ConferenceId) ||
					Utility.HasConferenceRole((User as ICISPrincipal), Model.ConferenceId, ConstValues.FunctionId.ConferenceSchedule, RoleType.修改) ||
					Utility.HasConferenceRole((User as ICISPrincipal), Model.ConferenceId, ConstValues.FunctionId.ConferenceSchedule, RoleType.删除))
					{
						<text>
						{
							field: "operate", title: "@Resources.Operate", align: "center", width: 200,
							formatter: function(value, rec) {
								var strInfo = "";
								var tmp = rec.schedulePlace == null ? "" : rec.schedulePlace.replace(new RegExp("'",'g'),"’").replace(new RegExp('"','g'),"“");
								@if ((User as ICISPrincipal).IsSSA || (User as ICISPrincipal).CSAList.Contains(Model.ConferenceId) || Utility.HasConferenceRole((User as ICISPrincipal), Model.ConferenceId, ConstValues.FunctionId.ConferenceSchedule, RoleType.修改))
								{
									<text>
								strInfo += "<a href='#' style='color:#FF8C00;font-weight:bold;text-decoration:underline;' onclick='dateTopicData(\""
									+ rec.id + "\",\""+ rec.conferenceId + "\")'>@Resources.ScheduleDateMaster</a>";
								strInfo += "&nbsp;|&nbsp;";
								strInfo += "<a href='#' style='color:#1874CD;font-weight:bold;text-decoration:underline;' onclick='topicChairmanData(\""
									+ rec.id + "\",\""+ rec.conferenceId + "\")'>@Resources.ChairmanMaster</a>";
								strInfo += "&nbsp;|&nbsp;";
								strInfo += "<a href='#' style='color:#66CDAA;font-weight:bold;text-decoration:underline;' onclick='editData(\""
									+ rec.id + "\")'>@Resources.Modify</a>";
								</text>
								}
								@if ((User as ICISPrincipal).IsSSA || (User as ICISPrincipal).CSAList.Contains(Model.ConferenceId) || Utility.HasConferenceRole((User as ICISPrincipal), Model.ConferenceId, ConstValues.FunctionId.ConferenceSchedule, RoleType.删除))
								{
									<text>
								if (strInfo != "") {
									strInfo += "&nbsp;|&nbsp;";
								}
								strInfo += "<a href='#' style='color:#DC143C;font-weight:bold;text-decoration:underline;' onclick='deleteData(\""
									+ rec.id + "\",\"" + tmp + "\")'>@Resources.Delete</a>";
								</text>
								}
								return strInfo;
							}
						},
					</text>
				}
				{ field: "schedulePlace", title: "@Resources.SchedulePlace", align: "center", sortable: true, width: 200 },
				{ field: "topicName", title: "@Resources.TopicName", align: "center", sortable: true, width: 300 },
				{
					field: "status", title: "@Resources.Status", align: "center", sortable: true, width: 100,
					formatter: function(value, rec) {
						if(value=="@ConstValues.Status.正常"){
							return "@Resources.Normal"
						}else{
							return "@Resources.Pause"
						}
					}},
				{ field: "remark", title: "@Resources.Remark", align: "center", sortable: true, width: 100 },
				{ field: "creator", title: "@Resources.Creator", align: "center", sortable: true, width: 100 },
				{ field: "createIP", title: "@Resources.CreateIP", align: "center", sortable: true, width: 150 },
				{ field: "createDate", title: "@Resources.CreateDate", align: "center", sortable: true, width: 150 },
			]],
			onBeforeLoad: function(param) {
				param.conferenceId = $("#hidConferenceId").val();
				param.random = Math.random();
			},
		});

		$(window).resize(function () {
			$("#dataGrid").datagrid("resize", {
				width: $(window).width() - 285,
				height: $(window).height() - 158
			});
		});

		$("#detailWindow").window({
			onOpen: function () {
				$(this).scrollTop(0);
			},
			top: ($(window).height() - 600) * 0.5
		});

		$("#dateTopicWindow").window({
			onOpen: function () {
				$(this).scrollTop(0);
			},
			width: $(window).width() - 285,
			height: $(window).height() - 158,
			left: ($(window).width() - windowWidth) * 0.5,
			top: ($(window).height() - windowHeight) * 0.5
		});

		$("#topicChairmanWindow").window({
			onOpen: function () {
				$(this).scrollTop(0);
			},
			top: ($(window).height() - 600) * 0.5
		});

		$("#chairmanWindow").window({
			onOpen: function () {
				$(this).scrollTop(0);
			},
			width: $(window).width() - 285,
			height: $(window).height() - 158,
			left: ($(window).width() - windowWidth) * 0.5,
			top: ($(window).height() - windowHeight) * 0.5
		});

		$("#planWindow").window({
			onOpen: function () {
				$(this).scrollTop(0);
			},
			width: $(window).width() - 285,
			height: $(window).height() - 158,
			left: ($(window).width() - windowWidth) * 0.5,
			top: ($(window).height() - windowHeight) * 0.5
		});
	});

	function searchData() {
		$("#dataGrid").datagrid("load", {
			SelSchedulePlace: $("#selSchedulePlace").textbox("getValue")
		});
	}

	function exportData(type){
		if (type == 1)
		{
			document.getElementById("frmExport").action = "@Url.Action(nameof(ConferenceScheduleController.Export))";
		} else if (type == 2)
		{
			document.getElementById("frmExport").action = "@Url.Action(nameof(ConferenceScheduleController.ExportPoster))";
		} else if (type == 3)
		{
			document.getElementById("frmExport").action = "@Url.Action(nameof(ConferenceScheduleController.ExportProgramAbstract))";
		}
		$("#hdnConferenceId").val("@Model.ConferenceId");
		$("#frmExport").submit();
	}

	function addData() {
		$("#hdnWindowType").val("add");
		$("#detailWindowTitle").text("@Resources.Create");
		$("#hidID").val("");
		$("#txtSchedulePlace").textbox("setValue", "");
		$("#ddlStatus").combobox("setValue", "@ConstValues.Status.正常");
		$("#txtSort").numberbox("setValue", @ConstValues.DefaultSort);
		$("#txtRemark").textbox("setValue", "");
		$("#detailWindow").window("open");
	}

	function editData(id) {
		var url = "@Url.Action(nameof(ConferenceScheduleController.GetEditData),
				nameof(ConferenceScheduleController).GetControllerName())" + "/" + id;
		$.get(url, null, function (data, textStatus, jqXHR) {
			if (data.result == "@ConstValues.AjaxFailResult") {
				common.showError(data.message);
				$("#dataGrid").datagrid("reload");
			} else {
				$("#hdnWindowType").val("edit");
				$("#detailWindowTitle").text("@Resources.Modify");
				$("#hidID").val(id);
				$("#txtSchedulePlace").textbox("setValue", data.data.schedulePlace);
				$("#ddlStatus").combobox("setValue", data.data.status);
				$("#txtSort").numberbox("setValue", data.data.sort);
				$("#txtRemark").textbox("setValue", data.data.remark);
				$("#detailWindow").window("open");
			}
		});
	}

	function deleteData(id, name) {
		var confirmMessage = "@Resources.CfmDelete";
		confirmMessage = confirmMessage.replace(/\{0\}/g, name);
		$.messager.confirm("@Resources.Delete", confirmMessage, function (r) {
			if (r) {
				$("#hidID").val(id);
				$.post("@Url.Action(nameof(ConferenceScheduleController.Delete),
						nameof(ConferenceScheduleController).GetControllerName(),
						new { ConferenceId = Model.ConferenceId })",
					$("#frmDetail").serialize(),
					function(data, textStatus, jqXHR) {
						if (data.result == "@ConstValues.AjaxFailResult") {
							common.showError(data.message);
						} else {
							common.showSuccess(data.message, true);
							$("#dataGrid").datagrid("reload");
						}
					}
				);
			}
		});
	}

	function saveData() {
		var isValid = $("#frmDetail").form("validate");

		if (isValid) {
			$.messager.confirm("@Resources.Save", "@Resources.CfmSave", function (r) {
				if (r) {
					var loading = layer.load(0,  {
						shade: [0.4,"#fff"]
					});
					switch ($("#hdnWindowType").val())
					{
						case "add":
							$.post("@Url.Action(nameof(ConferenceScheduleController.Create),
									nameof(ConferenceScheduleController).GetControllerName(),
									new { ConferenceId = Model.ConferenceId })",
								$("#frmDetail").serialize(),
								function(data, textStatus, jqXHR) {
									layer.close(loading);
									if (data.result == "@ConstValues.AjaxFailResult") {
										common.showError(data.message);
									} else {
										common.showSuccess(data.message, true);
										$("#detailWindow").window("close");
										$("#dataGrid").datagrid("reload");
									}
								}
							);
							break;
						case "edit":
							$.post("@Url.Action(nameof(ConferenceScheduleController.Modify),
									nameof(ConferenceScheduleController).GetControllerName(),
									new { ConferenceId = Model.ConferenceId })",
								$("#frmDetail").serialize(),
								function(data, textStatus, jqXHR) {
									layer.close(loading);
									if (data.result == "@ConstValues.AjaxFailResult") {
										common.showError(data.message);
									} else {
										common.showSuccess(data.message, true);
										$("#detailWindow").window("close");
										$("#dataGrid").datagrid("reload");
									}
								}
							);
							break;
					}
				}
			});
		}
	}

	function dateTopicData(id, conferenceId) {
		$("#hidDateTopicConferenceId").val(conferenceId);
		$("#hidScheduleId").val(id);

		$("#dateTopicDG").datagrid({
			url: "@Url.Action(nameof(ConferenceScheduleController.GetDateTopicData),
					nameof(ConferenceScheduleController).GetControllerName())",
			method: "get",
			singleSelect: true,
			fitColumns: true,
			height: (windowHeight - 99) - 302,
			nowrap: false,
			striped: true,
			columns: [[
				{
					field: "operate", title: "@Resources.Operate", align: "center", width: 120,
					formatter: function(value, rec) {
						var strInfo = "";
						strInfo += "<a href='#' style='color:#FF8C00;font-weight:bold;text-decoration:underline;' onclick='planData(\""
							+ rec.id + "\",\""+ conferenceId + "\")'>@Resources.ScheduleMaster</a>";
						strInfo += "&nbsp;|&nbsp;";
						strInfo += "<a href='#' style='color:#66CDAA;font-weight:bold;text-decoration:underline;' onclick='editDateTopic(\""
							+ rec.id + "\")'>@Resources.Modify</a>";
						strInfo += "&nbsp;|&nbsp;";
						strInfo += "<a href='#' style='color:#DC143C;font-weight:bold;text-decoration:underline;' onclick='deleteDateTopic(\""
							+ rec.id + "\",\"" + rec.scheduleDay+ "\")'>@Resources.Delete</a>";
						return strInfo;
					}
				},
				{ field: "scheduleDay", title: "@Resources.ScheduleDate", align: "center",  width: 80 },
				{ field: "forenoon", title: "@Resources.Forenoon", align: "center", width: 100 },
				{ field: "afternoon", title: "@Resources.Afternoon", align: "center", width: 100 },
				{ field: "evening", title: "@Resources.Evening", align: "center", width: 100 },
				{ field: "topicName", title: "@Resources.TopicName", align: "left",  width: 200 },
				{ field: "remark", title: "@Resources.Remark", align: "center",  width: 100 },
			]],
			onBeforeLoad: function(param) {
				param.scheduleId = $("#hidScheduleId").val();
				param.random = Math.random();
			}
		});

		$("#dateScheduleDate").combobox({
			editable: false,
			required: true,
			valueField: "scheduleDate",
			textField: "id",
			panelHeight: "auto",
			url: "@Url.Action(nameof(UtilityController.GetConferenceDate), nameof(UtilityController).GetControllerName())" + "?conferenceId=" + conferenceId,
		});

		var orgCount = 0;
		$("#ddlTopic").combogrid({
			editable: false,
			required: true,
			multiple: true,
			idField: "id",
			textField: "name",
			url: "@Url.Action(nameof(UtilityController.GetTopic), nameof(UtilityController).GetControllerName())" + "?conferenceId=" + conferenceId,
			columns:[[
				{ field: "ck", checkbox:true },
				{ field: "id", hidden: true },
				{ field: "name", title:"@Resources.TopicName" }
			]],
			onLoadSuccess: function(data) {
				orgCount = data.length;
			},
			onShowPanel: function () {
				if (orgCount < 10) {
					$(this).combogrid("panel").height("auto");
				} else {
					$(this).combogrid("panel").height(200);
				}
			},
			onHidePanel: function () { }
		});

		$("#hdnDateTopicType").val("add");
		$("#hidScheduleDateId").val("");
		$("#dateScheduleDate").combobox("setValue", "");
		$("#ddlTopic").combogrid("setValue", "");
		$("#dateForenoonStartTime").timespinner("setValue", "");
		$("#dateForenoonEndTime").timespinner("setValue", "");
		$("#dateAfternoonStartTime").timespinner("setValue", "");
		$("#dateAfternoonEndTime").timespinner("setValue", "");
		$("#dateEveningStartTime").timespinner("setValue", "");
		$("#dateEveningEndTime").timespinner("setValue", "");
		$("#txtDateTopicRemark").textbox("setValue", "");
		$("#dateTopicWindow").window("open");
	}

	function addDateTopic() {
		$("#hdnDateTopicType").val("add");
		$("#hidScheduleDateId").val("");
		$("#dateScheduleDate").combobox("setValue", "");
		$("#ddlTopic").combogrid("setValue", "");
		$("#dateForenoonStartTime").timespinner("setValue", "");
		$("#dateForenoonEndTime").timespinner("setValue", "");
		$("#dateAfternoonStartTime").timespinner("setValue", "");
		$("#dateAfternoonEndTime").timespinner("setValue", "");
		$("#dateEveningStartTime").timespinner("setValue", "");
		$("#dateEveningEndTime").timespinner("setValue", "");
		$("#txtDateTopicRemark").textbox("setValue", "");
		$("#dateTopicWindow").window("open");
	}

	function editDateTopic(id) {
		var url = "@Url.Action(nameof(ConferenceScheduleController.GetEditDateTopicData),
				nameof(ConferenceScheduleController).GetControllerName())" + "/" + id;
		$.get(url, null, function (data, textStatus, jqXHR) {
			if (data.result == "@ConstValues.AjaxFailResult") {
				common.showError(data.message);
				$("#dateTopicDG").datagrid("reload");
			} else {
				$("#hdnDateTopicType").val("edit");
				$("#hidScheduleDateId").val(id);
				$("#dateScheduleDate").combobox("setValue", data.data.scheduleDate);
				$("#ddlTopic").combogrid("setValues", data.data.topicId);
				$("#dateForenoonStartTime").timespinner("setValue", data.data.forenoonStartTime);
				$("#dateForenoonEndTime").timespinner("setValue", data.data.forenoonEndTime);
				$("#dateAfternoonStartTime").timespinner("setValue", data.data.afternoonStartTime);
				$("#dateAfternoonEndTime").timespinner("setValue", data.data.afternoonEndTime);
				$("#dateEveningStartTime").timespinner("setValue", data.data.eveningStartTime);
				$("#dateEveningEndTime").timespinner("setValue", data.data.eveningEndTime);
				$("#txtDateTopicRemark").textbox("setValue", data.data.remark);
				$("#dateTopicWindow").window("open");
			}
		});
	}

	function deleteDateTopic(id, name) {
		var confirmMessage = "@Resources.CfmDelete";
		confirmMessage = confirmMessage.replace(/\{0\}/g, name);
		$.messager.confirm("@Resources.Delete", confirmMessage, function (r) {
			if (r) {
				$("#hidScheduleDateId").val(id);
				$.post("@Url.Action(nameof(ConferenceScheduleController.DeleteDateReport),
						nameof(ConferenceScheduleController).GetControllerName(),
						new { ConferenceId = Model.ConferenceId })",
					$("#frmDateTopic").serialize(),
					function(data, textStatus, jqXHR) {
						if (data.result == "@ConstValues.AjaxFailResult") {
							common.showError(data.message);
						} else {
							common.showSuccess(data.message, true);
							$("#dateTopicDG").datagrid("reload");
						}
					}
				);
			}
		});
	}

	function saveDateTopic() {
		var isValid = $("#frmDateTopic").form("validate");

		if (isValid) {
			var ForenoonStartTime = $("#dateForenoonStartTime").timespinner("getValue");
			var ForenoonEndTime = $("#dateForenoonEndTime").timespinner("getValue");
			var AfternoonStartTime = $("#dateAfternoonStartTime").timespinner("getValue");
			var AfternoonEndTime = $("#dateAfternoonEndTime").timespinner("getValue");
			var EveningStartTime = $("#dateEveningStartTime").timespinner("getValue");
			var EveningEndTime = $("#dateEveningEndTime").timespinner("getValue");

			if (ForenoonStartTime == "" && ForenoonEndTime == "" && AfternoonStartTime == "" && AfternoonEndTime == "" && EveningStartTime == "" && EveningEndTime == "") {
				var errorMessage = "@Resources.ScheduleNotExistＭessage";
				common.showError(errorMessage);
				return;
			}

			if ((ForenoonStartTime == "" && ForenoonEndTime != "") || (ForenoonStartTime != "" && ForenoonEndTime == "")) {
				var errorMessage = "@Resources.MsgDateInputAlsoError";
				errorMessage = errorMessage.replace(/\{0\}/g, "@Resources.Forenoon@Resources.StartTime").replace(/\{1\}/g, "@Resources.Forenoon@Resources.EndTime");
				common.showError(errorMessage);
				return;
			} else if (ForenoonStartTime > ForenoonEndTime) {
				var errorMessage = "@Resources.MsgDateInputError";
				errorMessage = errorMessage.replace(/\{0\}/g, "@Resources.Forenoon@Resources.StartTime").replace(/\{1\}/g, "@Resources.Forenoon@Resources.EndTime");
				common.showError(errorMessage);
				return;
			}

			if ((AfternoonStartTime == "" && AfternoonEndTime != "") || (AfternoonStartTime != "" && AfternoonEndTime == "")) {
				var errorMessage = "@Resources.MsgDateInputAlsoError";
				errorMessage = errorMessage.replace(/\{0\}/g, "@Resources.Afternoon@Resources.StartTime").replace(/\{1\}/g, "@Resources.Afternoon@Resources.EndTime");
				common.showError(errorMessage);
				return;
			} else if (AfternoonStartTime > AfternoonEndTime) {
				var errorMessage = "@Resources.MsgDateInputError";
				errorMessage = errorMessage.replace(/\{0\}/g, "@Resources.Afternoon@Resources.StartTime").replace(/\{1\}/g, "@Resources.Afternoon@Resources.EndTime");
				common.showError(errorMessage);
				return;
			}

			if ((EveningStartTime == "" && EveningEndTime != "") || (EveningStartTime != "" && EveningEndTime == "")) {
				var errorMessage = "@Resources.MsgDateInputAlsoError";
				errorMessage = errorMessage.replace(/\{0\}/g, "@Resources.Evening@Resources.StartTime").replace(/\{1\}/g, "@Resources.Evening@Resources.EndTime");
				common.showError(errorMessage);
				return;
			} else if (EveningStartTime > EveningEndTime) {
				var errorMessage = "@Resources.MsgDateInputError";
				errorMessage = errorMessage.replace(/\{0\}/g, "@Resources.Evening@Resources.StartTime").replace(/\{1\}/g, "@Resources.Evening@Resources.EndTime");
				common.showError(errorMessage);
				return;
			}

			if (ForenoonEndTime != "" && AfternoonStartTime != "" && ForenoonEndTime > AfternoonStartTime) {
				var errorMessage = "@Resources.MsgDateInputError";
				errorMessage = errorMessage.replace(/\{0\}/g, "@Resources.Forenoon@Resources.EndTime").replace(/\{1\}/g, "@Resources.Afternoon@Resources.StartTime");
				common.showError(errorMessage);
				return;
			}

			if (AfternoonEndTime != "" && EveningStartTime != "" && AfternoonEndTime > EveningStartTime) {
				var errorMessage = "@Resources.MsgDateInputError";
				errorMessage = errorMessage.replace(/\{0\}/g, "@Resources.Afternoon@Resources.EndTime").replace(/\{1\}/g, "@Resources.Evening@Resources.StartTime");
				common.showError(errorMessage);
				return;
			}

			if (ForenoonEndTime != "" && EveningStartTime != "" && ForenoonEndTime > EveningStartTime) {
				var errorMessage = "@Resources.MsgDateInputError";
				errorMessage = errorMessage.replace(/\{0\}/g, "@Resources.Forenoon@Resources.EndTime").replace(/\{1\}/g, "@Resources.Evening@Resources.StartTime");
				common.showError(errorMessage);
				return;
			}

			$.messager.confirm("@Resources.Save", "@Resources.CfmSave", function (r) {
				if (r) {
					var loading = layer.load(0,  {
						shade: [0.4,"#fff"]
					});
					switch ($("#hdnDateTopicType").val())
					{
						case "add":
							$.post("@Url.Action(nameof(ConferenceScheduleController.CreateDateReport),
									nameof(ConferenceScheduleController).GetControllerName(),
									new { ConferenceId = Model.ConferenceId })",
								$("#frmDateTopic").serialize(),
								function(data, textStatus, jqXHR) {
									layer.close(loading);
									if (data.result == "@ConstValues.AjaxFailResult") {
										common.showError(data.message);
									} else {
										common.showSuccess(data.message, true);
										$("#dateTopicDG").datagrid("reload");
									}
								}
							);
							break;
						case "edit":
							$.post("@Url.Action(nameof(ConferenceScheduleController.ModifyDateReport),
									nameof(ConferenceScheduleController).GetControllerName(),
									new { ConferenceId = Model.ConferenceId })",
								$("#frmDateTopic").serialize(),
								function(data, textStatus, jqXHR) {
									layer.close(loading);
									if (data.result == "@ConstValues.AjaxFailResult") {
										common.showError(data.message);
									} else {
										common.showSuccess(data.message, true);
										$("#dateTopicDG").datagrid("reload");
									}
								}
							);
							break;
					}
				}
			});
		}
	}

	function topicChairmanData(id, conferenceId) {
		$("#topicChairmanDG").datagrid({
			url: "@Url.Action(nameof(ConferenceScheduleController.GetTopicChairmanData),
					nameof(ConferenceScheduleController).GetControllerName())",
			method: "get",
			fitColumns: true,
			nowrap: false,
			striped: true,
			columns: [[
				{
					field: "operate", title: "@Resources.Operate", align: "center", width: 100,
					formatter: function(value, rec) {
						var strInfo = "";
						strInfo += "<a href='#' style='color:#1874CD;font-weight:bold;text-decoration:underline;' onclick='addChairman(\""
							+ conferenceId + "\",\"" + rec.topicId + "\")'>@Resources.Chairman</a>";
						return strInfo;
					}
				},
				{ field: "schedulePlace", title: "@Resources.SchedulePlace", align: "center", sortable: true, width: 200 },
				{ field: "topicName", title: "@Resources.TopicName", align: "center", sortable: true, width: 300 }
			]],
			onBeforeLoad: function(param) {
				param.conferenceId = conferenceId;
				param.scheduleId = id;
				param.random = Math.random();
			}
		});
		$("#topicChairmanWindow").window("open");
	}

	function addChairman(conferenceId, topicId) {
		$("#hidChairConferenceId").val(conferenceId);
		$("#hidTopicId").val(topicId);
		$("#hidChairman").val("");
		$("#selMail").textbox("setValue","");
		$("#selAuthorName").textbox("setValue","");
		$("#chairmanDG").datagrid({
			url: "@Url.Action(nameof(ConferenceScheduleController.GetChairmanData),
					nameof(ConferenceScheduleController).GetControllerName(), new { ConferenceId = Model.ConferenceId })",
			method: "get",
			fitColumns: true,
			height: (windowHeight - 99) * 0.45,
			nowrap: false,
			pageSize: @ConstValues.DefaultGridRows,
			striped: true,
			columns: [[
				{ field: "chk", align: "center", checkbox: true },
				{ field: "fullName", title: "@Resources.FullName", align: "center", width: 200 },
				{ field: "mail", title: "@Resources.Mail", align: "center", width: 250 },
				{ field: "affiliation", title: "@Resources.Affiliation", align: "center", width: 300 },
			]],
			onBeforeLoad: function(param) {
				param.conferenceId = $("#hidChairConferenceId").val();
				param.topicId = $("#hidTopicId").val();
				param.random = Math.random();
				param.selMail = $("#selMail").textbox("getValue");
				param.selAuthorName = $("#selAuthorName").textbox("getValue");
				if (param.selMail == "" && param.selAuthorName == "") {
					return false;
				}
			},
			onLoadSuccess: function(data) {
				$("#hidChairman").val("");
				if (data.rows.length > 0) {
					for (var rowIndex = 0; rowIndex < data.rows.length; rowIndex++) {
						if (data.rows[rowIndex].flag != null) {
							$("input[type='checkbox']").eq(rowIndex + 1).prop("checked", true);
							var strId = data.rows[rowIndex].id.toString();
							if ($("#hidChairman").val() == "") {
								$("#hidChairman").val(strId);
							} else {
								var exportIdList = $("#hidChairman").val();
								var exportIdArray = exportIdList.split(',');
								var newArray = exportIdArray.concat(strId);
								$("#hidChairman").val(newArray.join());
							}
						}
					}
				}
			},
			onCheck: function (rowIndex, rowData) {
				var exportIdList = $("#hidChairman").val();
				var strId = rowData.id.toString();
				if (exportIdList == "") {
					$("#hidChairman").val(strId);
				} else {
					var exportIdArray = exportIdList.split(',');
					var newArray = exportIdArray.concat(strId);
					$("#hidChairman").val(newArray.join());
				}
			},
			onUncheck: function (rowIndex, rowData) {
				var exportIdList = $("#hidChairman").val();
				var exportIdArray = exportIdList.split(',');
				var strId = rowData.id.toString();
				exportIdArray.remove(strId);
				$("#hidChairman").val(exportIdArray.join());
			},
			onCheckAll: function (rows) {
				var exportIdList = $("#hidChairman").val();
				if (exportIdList == "") {
					var newArray = new Array();
					for (var index = 0; index < rows.length; index++) {
						var strId = rows[index].id.toString();
						newArray = newArray.concat(strId);
					}
					$("#hidChairman").val(newArray.join());
				} else {
					var exportIdArray = exportIdList.split(',');
					var newArray = exportIdArray;
					for (var index = 0; index < rows.length; index++) {
						var strId = rows[index].id.toString();
						if (newArray.indexOf(strId) < 0) {
							newArray = newArray.concat(strId);
						}
					}
					$("#hidChairman").val(newArray.join());
				}
			},
			onUncheckAll: function (rows) {
				var exportIdList = $("#hidChairman").val();
				var exportIdArray = exportIdList.split(',');
				for (var index = 0; index < rows.length; index++) {
					var strId = rows[index].id.toString();
					exportIdArray.remove(strId);
				}
				$("#hidChairman").val(exportIdArray.join());
			},
		});

		$("#chairmanDG2").datagrid({
			url: "@Url.Action(nameof(ConferenceScheduleController.GetAllChairmanData),
					nameof(ConferenceScheduleController).GetControllerName(), new { ConferenceId = Model.ConferenceId })",
			method: "get",
			singleSelect: true,
			fitColumns: true,
			height: (windowHeight - 99) * 0.4,
			nowrap: false,
			pageSize: @ConstValues.DefaultGridRows,
			striped: true,
			columns: [[
				{
					field: "operate", title: "@Resources.Operate", align: "center", width: 100,
					formatter: function(value, rec) {
						var tmp = rec.fullName == null ? "" : rec.fullName.replace(new RegExp("'",'g'),"’").replace(new RegExp('"','g'),"“");
						var strInfo = "<a href='#' style='color:#DC143C;font-weight:bold;text-decoration:underline;' onclick='deleteChairman(\""
							+ rec.id + "\",\"" + tmp + "\")'>@Resources.Delete</a>";
						return strInfo;
					}
				},
				{ field: "fullName", title: "@Resources.FullName", align: "center", width: 200 },
				{ field: "mail", title: "@Resources.Mail", align: "center", width: 250 },
				{ field: "affiliation", title: "@Resources.Affiliation", align: "center", width: 300 },
				{ field: "scheduleStatus", title: "@Resources.ScheduleStatus", align: "center", width: 100 },
			]],
			onBeforeLoad: function(param) {
				param.conferenceId = $("#hidChairConferenceId").val();
				param.topicId = $("#hidTopicId").val();
				param.random = Math.random();
			},
		});
		$("#chairmanWindow").window("open");
	}

	function searchChairmanData() {
		if ($("#selMail").textbox("getValue")=="" && $("#selAuthorName").textbox("getValue")=="") {
			common.showError("@Resources.MsgFillNameAndMail");
		}
		$("#chairmanDG").datagrid("load", {
			SelMail: $("#selMail").textbox("getValue"),
			SelAuthorName: $("#selAuthorName").textbox("getValue"),
		});
	}

	function saveChairmanData() {
		if ($("#hidChairman").val() != "") {
			$.messager.confirm("@Resources.Save", "@Resources.CfmSave", function (r) {
				if (r) {
					var loading = layer.load(0,  {
						shade: [0.4,"#fff"]
					});
					$.post("@Url.Action(nameof(ConferenceScheduleController.UpdateChairman),
							nameof(ConferenceScheduleController).GetControllerName(), new { ConferenceId = Model.ConferenceId })",
						$("#frmChairman").serialize(),
						function(data, textStatus, jqXHR) {
							layer.close(loading);
							if (data.result == "@ConstValues.AjaxFailResult") {
								common.showError(data.message);
							} else {
								common.showSuccess(data.message, true);
								$("#chairmanDG").datagrid("reload");
								$("#chairmanDG2").datagrid("reload");
							}
						}
					);
				}
			});
		} else {
			$.messager.alert("", "@Resources.MsgRecordMust", "warning");
		}
	}

	function planData(scheduleDateId, conferenceId) {
		$("#hidPlanConferenceId").val(conferenceId);
		$("#hidPlanDateId").val(scheduleDateId);

		$("#PlanDG").datagrid({
			url: "@Url.Action(nameof(ConferenceScheduleController.GetPlanData),
					nameof(ConferenceScheduleController).GetControllerName())",
			method: "get",
			fitColumns: true,
			height: (windowHeight - 99) * 0.6,
			nowrap: false,
			striped: true,
			rowStyler: function(index, row) {
				if (row.status == "@ConstValues.ScheduleStatus.已取消") {
					return 'background-color:#CCCCCC;';
				}
				else if (row.isLock == true) {
					return 'background-color:#ADD2EB;';
				}
			},
			columns: [[
				{ field: "flag", align: "center",  width: 30 },
				{
					field: "operate", title: "@Resources.Operate", align: "center", width: 150,
					formatter: function(value, rec, index,row) {
						var strInfo = "";
						strInfo += "<a href='#' style='color:#FF8C00;font-weight:bold;text-decoration:underline;' onclick='cancelSchedulePlan(\""
							+ index + "\",\"" + rec.id + "\",\""+ rec.essayTitle + "\",\""+ rec.isContribute + "\")'>@Resources.Delete</a>";
						strInfo += "&nbsp;&nbsp;&nbsp;&nbsp;|&nbsp;";
						if (rec.isLock == true) {
							strInfo += "<a href='#' style='color:#000000;font-weight:bold;text-decoration:underline;' onclick='lockSchedulePlan(\""
								+ index + "\",\"" + rec.id + "\",\""+ rec.essayTitle + "\",\"false\")'>@Resources.ScheduleUnLock</a>";
						} else {
							strInfo += "<a href='#' style='color:#1874CD;font-weight:bold;text-decoration:underline;' onclick='lockSchedulePlan(\""
								+ index + "\",\"" + rec.id + "\",\""+ rec.essayTitle + "\",\"true\")'>@Resources.ScheduleLock</a>";
						}
						strInfo += "<br />";
						strInfo += "<a href='#' style='color:#66CDAA;font-weight:bold;text-decoration:underline;' onclick='moveSchedulePlan(\""
							+ index + "\",\"" + rec.id+ "\",\"true\")'>@Resources.ScheduleUp</a>";
						strInfo += "&nbsp;|&nbsp;";
						strInfo += "<a href='#' style='color:#66CDAA;font-weight:bold;text-decoration:underline;' onclick='moveSchedulePlan(\""
							+ index + "\",\"" + rec.id+"\",\"false\")'>@Resources.ScheduleDown</a>";
						strInfo += "&nbsp;|&nbsp;";
						if (rec.status == "@ConstValues.ScheduleStatus.已取消") {
							strInfo += "<a href='#' style='color:#000000;font-weight:bold;text-decoration:underline;' onclick='recoverSchedulePlan(\""
								+ index + "\",\"" + rec.id + "\",\""+ rec.essayTitle + "\",\"@ConstValues.ScheduleStatus.已取消\")'>@Resources.ScheduleRecover</a>";
						} else {
							strInfo += "<a href='#' style='color:#DC143C;font-weight:bold;text-decoration:underline;' onclick='recoverSchedulePlan(\""
								+ index + "\",\"" + rec.id + "\",\""+ rec.essayTitle + "\",\"@ConstValues.ScheduleStatus.已安排\")'>@Resources.Cancel</a>";
						}
						return strInfo;
					}
				},
				{ field: "reportType", title: "@Resources.ReportType", align: "center", width: 80 },
				{ field: "topicName", title: "@Resources.TopicName", align: "center", width: 200 },
				{ field: "contributeId", title: "@Resources.ContributionID", align: "center", width: 150 },
				{ field: "essayTitle", title: "@Resources.EssayTitle", align: "center", width: 200 },
				{ field: "fullName", title: "@Resources.Presenter", align: "center", width: 60 },
				{ field: "affiliation", title: "@Resources.Affiliation", align: "center", width: 100 },
				{ field: "startTime", title: "@Resources.StartTime", align: "center", width: 80 },
				{ field: "endTime", title: "@Resources.EndTime", align: "center", width: 80 },
				{ field: "duration", title: "@Resources.Duration", align: "center", width: 50 },
				{ field: "remark", title: "@Resources.Remark", align: "center", width: 50 },
				{ field: "isContribute", hidden: true },
			]],
			onBeforeLoad: function(param) {
				param.scheduleDateId = $("#hidPlanDateId").val();
				param.random = Math.random();
			},
			onLoadSuccess: function (data) {
				$(this).datagrid("enableDnd");
				$(this).datagrid("autoMergeCells", ["flag"]);
				var flags = document.getElementsByClassName("datagrid-td-merged");
				for (var index = 0; index < flags.length; index++) {
					flags[index].style.background = "#ffffff";
				}
			},
			onBeforeDrop:  function(targetRow, sourceRow, point) {
				var sourceIndex = $("#PlanDG").datagrid("getRowIndex", sourceRow);
				var targetIndex = $("#PlanDG").datagrid("getRowIndex", targetRow);
				if (sourceIndex == targetIndex) {
					return false;
				}

				if (sourceRow.status == "@ConstValues.ScheduleStatus.已取消") {
					common.showError("@Resources.MsgCancelCanNotChange");
					return false;
				}
				if (sourceRow.isLock == true) {
					common.showError("@Resources.MsgLockCanNotChange");
					return false;
				}
			},
			onDrop: function(targetRow, sourceRow, point) {
				$("#hidScheduleInfoId").val(sourceRow.id);
				$("#hidTargetId").val(targetRow.id);

				$.post("@Url.Action(nameof(ConferenceScheduleController.DropSchedulePlan),
						nameof(ConferenceScheduleController).GetControllerName(),
						new { ConferenceId = Model.ConferenceId })",
					$("#frmPlan").serialize(),
					function(data, textStatus, jqXHR) {
						if (data.result == "@ConstValues.AjaxFailResult") {
							common.showError(data.message);
						} else {
							common.showSuccess(data.message, true);
						}
						$("#PlanDG").datagrid("reload");
					}
				);
			}
		});

		$("#WaitDG").datagrid({
			url: "@Url.Action(nameof(ConferenceScheduleController.GetWaitData),
					nameof(ConferenceScheduleController).GetControllerName())",
			method: "get",
			singleSelect: true,
			fitColumns: true,
			height: (windowHeight - 99) * 0.4 - 40,
			nowrap: false,
			striped: true,
			columns: [[
				{
					field: "operate", title: "@Resources.Operate", align: "center", width: 50,
					formatter: function(value, rec) {
						var strInfo = "<a href='#' style='color:#66CDAA;font-weight:bold;text-decoration:underline;' onclick='schedulePlan(\""
							+ rec.id + "\",\""+ rec.duration + "\",\"true\")'>@Resources.SchedulePlan</a>";
						return strInfo;
					}
				},
				{ field: "reportType", title: "@Resources.ReportType", align: "center", width: 80 },
				{ field: "topicName", title: "@Resources.TopicName", align: "center", width: 200 },
				{ field: "id", title: "@Resources.ContributionID", align: "center", width: 150 },
				{ field: "essayTitle", title: "@Resources.EssayTitle", align: "center", width: 200 },
				{ field: "fullName", title: "@Resources.Presenter", align: "center",  width: 60 },
				{ field: "affiliation", title: "@Resources.Affiliation", align: "center", width: 100 },
				{ field: "remark", title: "@Resources.Remark", align: "center", width: 50 },
			]],
			onBeforeLoad: function(param) {
				param.conferenceId = $("#hidPlanConferenceId").val();
				param.scheduleDateId = $("#hidPlanDateId").val();
				param.reportTypeId = $("#selReportType").combobox("getValue");
				param.topicId = $("#selTopicName").combobox("getValue");
				param.random = Math.random();
			}
		});

		$("#selTopicName").combobox({
			editable: false,
			required: false,
			multiple: false,
			valueField: 'id',
			textField: 'name',
			url: "@Url.Action(nameof(ConferenceScheduleController.GetTopicWithSchedule),
					nameof(ConferenceScheduleController).GetControllerName())"
					+ "?scheduleId=" + $("#hidScheduleId").val() +"&scheduleDateId="+$("#hidPlanDateId").val(),
			columns:[[
				{ field: "id", hidden: true },
				{ field: "name", title:"@Resources.TopicName" }
			]],
			onLoadSuccess: function(data) {
				orgCount = data.length;
			},
			onShowPanel: function () {
				if (orgCount < 10) {
					$(this).combogrid("panel").height("auto");
				} else {
					$(this).combogrid("panel").height(200);
				}
			},
			onSelect: function () {
				searchWaitDG();
			}
		});

		$("#selReportType").combobox({
			editable: false,
			required: false,
			multiple: false,
			valueField: 'id',
			textField: 'name',
			url: "@Url.Action(nameof(UtilityController.GetReportWithAll),
					nameof(UtilityController).GetControllerName())" + "?conferenceId=" + conferenceId,
			columns:[[
				{ field: "id", hidden: true },
				{ field: "name", title:"@Resources.ReportType" }
			]],
			onLoadSuccess: function(data) {
				orgCount = data.length;
			},
			onShowPanel: function () {
				if (orgCount < 10) {
					$(this).combogrid("panel").height("auto");
				} else {
					$(this).combogrid("panel").height(200);
				}
			},
			onSelect: function () {
				searchWaitDG();
			}
		});

		$("#EventDG").datagrid({
			url: "@Url.Action(nameof(ConferenceScheduleController.GetEventData),
					nameof(ConferenceScheduleController).GetControllerName())",
			method: "get",
			singleSelect: true,
			fitColumns: true,
			height: (windowHeight - 99) * 0.4 - 40,
			nowrap: false,
			striped: true,
			columns: [[
				{
					field: "operate", title: "@Resources.Operate", align: "center", width: 50,
					formatter: function(value, rec) {
						var strInfo = "<a href='#' style='color:#66CDAA;font-weight:bold;text-decoration:underline;' onclick='schedulePlan(\""
							+ rec.id + "\",\""+ rec.duration + "\",\"false\")'>@Resources.SchedulePlan</a>";
						return strInfo;
					}
				},
				{ field: "eventName", title: "@Resources.ScheduleEventName", align: "center", width: 100 },
				{ field: "duration", title: "@Resources.Duration", align: "center", width: 50 },
				{ field: "topicName", title: "@Resources.TopicName", align: "center", width: 100 },
				{ field: "remark", title: "@Resources.Remark", align: "center", width: 50 },
			]],
			onBeforeLoad: function(param) {
				param.conferenceId = $("#hidPlanConferenceId").val();
				param.scheduleDateId = $("#hidPlanDateId").val();
				param.random = Math.random();
			}
		});

		$("#planWindow").window("open");
	}

	function schedulePlan(contributeId, duration, isContribute) {
		$("#hidContributeId").val(contributeId);
		$("#hidDuration").val(duration);
		$("#hidIsContribute").val(isContribute);

		$.post("@Url.Action(nameof(ConferenceScheduleController.SchedulePlan),
				nameof(ConferenceScheduleController).GetControllerName(),
				new { ConferenceId = Model.ConferenceId })",
			$("#frmPlan").serialize(),
			function(data, textStatus, jqXHR) {
				if (data.result == "@ConstValues.AjaxFailResult") {
					common.showError(data.message);
				} else {
					common.showSuccess(data.message, true);
					$("#PlanDG").datagrid("reload");
					if (isContribute == "true") {
						$("#WaitDG").datagrid("reload");
					} else {
						$("#EventDG").datagrid("reload");
					}
				}
			}
		);
	}

	function lockSchedulePlan(index, id, name, isLock) {
		var rows = $("#PlanDG").datagrid("getRows");
		var src = rows[index];
		if (src.status == "@ConstValues.ScheduleStatus.已取消") {
			common.showError("@Resources.MsgCancelCanNotChange");
			return;
		}

		var confirmMessage = "@Resources.CfmUnLockPlan";
		if (isLock == "true") {
			confirmMessage = "@Resources.CfmLockPlan";
		}
		confirmMessage = confirmMessage.replace(/\{0\}/g, name);
		$.messager.confirm("@Resources.Save", confirmMessage, function (r) {
			if (r) {
				$("#hidScheduleInfoId").val(id);
				$("#hidIsLock").val(isLock);
				$.post("@Url.Action(nameof(ConferenceScheduleController.LockSchedulePlan),
						nameof(ConferenceScheduleController).GetControllerName(),
						new { ConferenceId = Model.ConferenceId })",
					$("#frmPlan").serialize(),
					function(data, textStatus, jqXHR) {
						if (data.result == "@ConstValues.AjaxFailResult") {
							common.showError(data.message);
						} else {
							common.showSuccess(data.message, true);
							$("#PlanDG").datagrid("reload");
						}
					}
				);
			}
		});
	}

	function recoverSchedulePlan(index, id, name, status) {
		var rows = $("#PlanDG").datagrid("getRows");
		var src = rows[index];
		if (src.isLock == true) {
			common.showError("@Resources.MsgLockCanNotChange");
			return;
		}

		var confirmMessage = "@Resources.CfmCancelPlan";
		if (status == "@ConstValues.ScheduleStatus.已取消") {
			confirmMessage = "@Resources.CfmRecoverPlan";
		}
		confirmMessage = confirmMessage.replace(/\{0\}/g, name);
		$.messager.confirm("@Resources.Save", confirmMessage, function (r) {
			if (r) {
				$("#hidScheduleInfoId").val(id);
				$("#hidScheduleStatus").val(status);
				$.post("@Url.Action(nameof(ConferenceScheduleController.RecoverSchedulePlan),
						nameof(ConferenceScheduleController).GetControllerName(),
						new { ConferenceId = Model.ConferenceId })",
					$("#frmPlan").serialize(),
					function(data, textStatus, jqXHR) {
						if (data.result == "@ConstValues.AjaxFailResult") {
							common.showError(data.message);
						} else {
							common.showSuccess(data.message, true);
							$("#PlanDG").datagrid("reload");
						}
					}
				);
			}
		});
	}

	function cancelSchedulePlan(index, id, name, isContribute) {
		var rows = $("#PlanDG").datagrid("getRows");
		var src = rows[index];
		if (src.status == "@ConstValues.ScheduleStatus.已取消") {
			common.showError("@Resources.MsgCancelCanNotChange");
			return;
		}
		if (src.isLock == true) {
			common.showError("@Resources.MsgLockCanNotChange");
			return;
		}

		var confirmMessage = "@Resources.CfmCancelPlan";
		confirmMessage = confirmMessage.replace(/\{0\}/g, name);
		$.messager.confirm("@Resources.Save", confirmMessage, function (r) {
			if (r) {
				$("#hidScheduleInfoId").val(id);
				$.post("@Url.Action(nameof(ConferenceScheduleController.CancelSchedulePlan),
						nameof(ConferenceScheduleController).GetControllerName(),
						new { ConferenceId = Model.ConferenceId })",
					$("#frmPlan").serialize(),
					function(data, textStatus, jqXHR) {
						if (data.result == "@ConstValues.AjaxFailResult") {
							common.showError(data.message);
						} else {
							common.showSuccess(data.message, true);
							$("#PlanDG").datagrid("reload");
							if (isContribute == "true") {
								$("#WaitDG").datagrid("reload");
							} else {
								$("#EventDG").datagrid("reload");
							}
						}
					}
				);
			}
		});
	}

	function moveSchedulePlan(index, id, isUp) {
		var rows = $("#PlanDG").datagrid("getRows");
		var src = rows[index];
		if (isUp == "true") {
			if (index == 0) {
				common.showError("@Resources.MsgFirstCanNotUp");
				return;
			}
			if (src.status == "@ConstValues.ScheduleStatus.已取消") {
				common.showError("@Resources.MsgCancelCanNotChange");
				return;
			}
			if (src.isLock == true) {
				common.showError("@Resources.MsgLockCanNotChange");
				return;
			}
			var des = rows[parseInt(index) - 1];
			if (des.status == "@ConstValues.ScheduleStatus.已取消") {
				common.showError("@Resources.MsgCancelCanNotChangeDes");
				return;
			}
			if (des.isLock == true) {
				common.showError("@Resources.MsgLockCanNotChangeDes");
				return;
			}
		}
		else if (isUp == "false") {
			if (index == rows.length - 1) {
				common.showError("@Resources.MsgLastCanNotDown");
				return;
			}
			if (src.status == "@ConstValues.ScheduleStatus.已取消") {
				common.showError("@Resources.MsgCancelCanNotChange");
				return;
			}
			if (src.isLock == true) {
				common.showError("@Resources.MsgLockCanNotChange");
				return;
			}
			var des = rows[parseInt(index) + 1];
			if (des.status == "@ConstValues.ScheduleStatus.已取消") {
				common.showError("@Resources.MsgCancelCanNotChangeDes");
				return;
			}
			if (des.isLock == true) {
				common.showError("@Resources.MsgLockCanNotChangeDes");
				return;
			}
		}

		$("#hidScheduleInfoId").val(id);
		$("#hidIsUp").val(isUp);
		$.post("@Url.Action(nameof(ConferenceScheduleController.MoveSchedulePlan),
				nameof(ConferenceScheduleController).GetControllerName(),
				new { ConferenceId = Model.ConferenceId })",
			$("#frmPlan").serialize(),
			function(data, textStatus, jqXHR) {
				if (data.result == "@ConstValues.AjaxFailResult") {
					common.showError(data.message);
				} else {
					common.showSuccess(data.message, true);
					$("#PlanDG").datagrid("reload");
				}
			}
		);
	}

	function searchWaitDG() {
		$("#WaitDG").datagrid("reload");
	}

	function deleteChairman(id, fullName) {
		var confirmMessage = "@Resources.CfmDelete";
		confirmMessage = confirmMessage.replace(/\{0\}/g, fullName);
		$.messager.confirm("@Resources.Delete", confirmMessage, function (r) {
			if (r) {
				$("#hidChairmanId").val(id);
				$.post("@Url.Action(nameof(ConferenceScheduleController.DeleteChairman),
						nameof(ConferenceScheduleController).GetControllerName(), new { ConferenceId = Model.ConferenceId })",
					$("#frmChairman").serialize(),
					function(data, textStatus, jqXHR) {
						if (data.result == "@ConstValues.AjaxFailResult") {
							common.showError(data.message);
						} else {
							common.showSuccess(data.message, true);
							$("#chairmanDG2").datagrid("reload");
						}
					}
				);
			}
		});
	}
</script>
}